const { ccclass, property } = cc._decorator;

import ConfigDataMgr from "./ConfigDataMgr";

@ccclass
export default class ConfigDataSys extends ConfigDataMgr {
    static _instance = null;
    
    constructor() {
        super();
    }

    static _getInstance() {
        if (!ConfigDataSys._instance) {
            ConfigDataSys._instance = new ConfigDataSys();
        }
        return ConfigDataSys._instance;
    }
    
    init(e) {
        let t = e.color_conf;
        this.initColor(t);
    }

    initColor(e) {
        let t = new Map();

        for (let a in e) {
            let o = e[a],
                i = o.colorValue,
                r = o.color,
                n = o.number,
                l = o.show;

            t.set(n, {
                color: i,
                name: l,
                color_name: r
            });
        }

        this.color = t;
    }

    getColorData(e) {
        return this.color.get(e).color;
    }
}

const r = ConfigDataSys._getInstance();
